package com.ghca.myinfo.system.repositories;

import com.ghca.myinfo.system.entities.Permission;
import com.ghca.myinfo.system.entities.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * Created by Administrator on 2017/1/24.
 */
@Repository
public interface PermissionRepository extends JpaRepository<Permission, String>{

    List<Permission> findDistinctByEnabledTrueAndParentIsNullAndRolesIn(Set<Role> roles);

    List<Permission> findDistinctByEnabledTrueAndRootIdAndRolesIn(String parentId, Set<Role> roles);
}
